<template>
  <el-dialog
    :title="title"
    :close-on-click-modal="false"
    :visible.sync="visible"
    :before-close="cancel"
    class="JNPF-dialog JNPF-dialog_center"
    lock-scroll
    width="65%"
  >
    <el-row :gutter="15" class="">
      <el-form
        ref="elForm"
        :model="dataForm"
        :rules="rules"
        label-width="160px"
      >

       <el-col :span="12">
          <el-form-item label="申请单号" prop="FBILLNO">
            <el-input v-model="dataForm.FBILLNO"  disabled />
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="申请日期" prop="FBILLCREDATE">
            <el-date-picker v-model="dataForm.FBILLCREDATE" value-format="yyyy-MM-DD" type="date" placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="屏蔽人员" class="required" prop="FUSER">
            <el-input
              v-model="dataForm.FUSER"
              placeholder="请输入"
              :style="{ width: '100%' }"
            >
            </el-input>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="状态">
            <el-select v-model="dataForm.FBILLSTATE" placeholder="请选择">
              <el-option
                v-for="item in options1"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="有效起日" prop="FBEGDATE">
            <el-date-picker v-model="dataForm.FBEGDATE" value-format="yyyy-MM-DD" type="date" placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="有效讫日" prop="FENDDATE">
            <el-date-picker v-model="dataForm.FENDDATE" value-format="yyyy-MM-DD" type="date" placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
        </el-col>


        <el-col :span="24">
          <el-form-item label="屏蔽理由" prop="FMEMO">
            <el-input
              type="textarea"
              :autosize="{ minRows: 2, maxRows: 5}"
              placeholder="请输入内容"
              v-model="textarea1"
            >
            </el-input>
          </el-form-item>
        </el-col>

      </el-form>
    </el-row>
    <span slot="footer" class="dialog-footer">
      <el-button @click="cancel">取 消</el-button>
      <el-button  v-if="insertorupdate" type="primary" v-loading="loading">确 定</el-button>
      <el-button v-else type="primary"  v-loading="loading">修 改</el-button>
    </span>
  </el-dialog>
</template>
<script>
import jnpf from "@/utils/jnpf"
export default {
  props: {
    parelist: {
      type: Array,
      default: []
    },
  },
  data() {
    return {
        url: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
        title:"新增",
        dataForm:{
            FBILLNO: "K241130001", 
            FBILLCREDATE:"2024-11-30",
            FUSER: "曹操",
            FMEMO: "有机化学实验操作课",
            FBEGDATE: "2024-12-01",
            FENDDATE: "2025-11-30",
            FCHECKUSE: "",
            FCHECKDATE: "",
            FNOTE:"",
            FBILLSTATE: "申请中"
        },
        rules: {
            FUSER: [
                { required: true, message: '请输入屏蔽人员', trigger: 'blur' },
            ],
            FMEMO: [
                { required: true, message: '请输入屏蔽理由', trigger: 'blur' },
            ]
        },
      
      options1: [{
          value: '1',
          label: '申请中'
        }, {
          value: '2',
          label: '已通过'
        }, {
          value: '3',
          label: '已驳回'
        }],

      loading:false,
      visible:false,
      insertorupdate:true
    };
  },
  created() {
  },
  mounted() {},
  methods: {
    //
    init(id){
      this.dataForm.FCATNO= id || ''
        if(this.dataForm.FCATNO)
        {
            this.title="修改"
           this.insertorupdate=false;
        }
        else
        {
          this.insertorupdate=true;
            this.title="新增";
        }
        this.visible=true;
    },
    //
    cancel(){
        this.$refs.elForm.resetFields();
        this.visible=false;
    },
  },
};
</script>
